package xyz.qduwo.servlet.manager;

import com.google.gson.Gson;
import xyz.qduwo.dao.UserDao;
import xyz.qduwo.entity.UserEntity;
import xyz.qduwo.util.RespUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/admin/manager/SelectUsers")
public class SelectUsers extends HttpServlet {
    List<UserEntity> list;


    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        list = UserDao.findAll();
        resp.setContentType("application/x-json;charset=utf-8");
        resp.getWriter().println(RespUtils.success(list));
    }
}